#ifndef RWLock_h
#define RWLock_h
#include <iostream>
#include <pthread.h>

class RWLock {
    public:
        RWLock();
        ~RWLock();
        void rlock();
        void wlock();
        void runlock();
        void wunlock();

        class Lightswitch{
            public:
                Lightswitch();
                ~Lightswitch();
                void lock(pthread_mutex_t * semaphore);
                void unlock(pthread_mutex_t * semaphore);
            private:
                int counter;
                pthread_mutex_t mutex_ls;

        };

    private:


        Lightswitch ls;
        pthread_mutex_t roomEmpty;
        pthread_mutex_t turnstile;

};

#endif
